$(document).ready(function(){

	$.getJSON('controller/cont.data_kartu.php',{aksi_get_kartu:true},function(data){
		$("#list_kartu tbody").html("");
		var tab="";
		var jml=0;
		if(data.msg){
			$.each(data.kartu, function(index, kartu) {
				tab += "<tr>";
                tab += "<td>" + kartu.ref + "</td>";
                tab += "<td>" + kartu.cuti.tglAwal + " s.d. " + kartu.cuti.tglAkhir + "</td>";
                tab += "<td>" + kartu.kartu.nomorSurat + "</td>";
                tab += "<td>" + kartu.kartu.tglSurat + "</td>";
                tab += "<td>" + kartu.cuti.jmlHari + "</td>";
                tab += "<td>&nbsp;</td>";
                tab += "</tr>";
                if(kartu.isBatal){
					tab += "<tr>";
	                tab += "<td>" + kartu.ref + "</td>";
	                tab += "<td>" + kartu.batal.tglAwal + " s.d. " + kartu.batal.tglAkhir + "</td>";
	                tab += "<td>" + kartu.kartu.nomorSurat + "</td>";
	                tab += "<td>" + kartu.kartu.tglSurat + "</td>";
	                tab += "<td>(" + kartu.batal.jmlHariBatal + ")</td>";
	                tab += "<td> Batal Karena "+ kartu.batal.Alasan +"</td>";
	                tab += "</tr>";
				}else{

				}
            });
		}else{
			tab += "<tr>"
            tab += "<td>Data Tidak Ada</td>";
            tab += "</tr>";
		}
		$('#list_kartu tbody').append(tab);
	});
});